﻿using Infragistics.Composite.Wpf.Samples.Infrastructure;
using Infragistics.Composite.Wpf.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Infragistics.Composite.Wpf.Samples.ClockModule.Tests
{
    /// <summary>
    ///This is a test class for ClockModuleTest and is intended
    ///to contain all ClockModuleTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ClockModuleTest
    {
        #region Boilerplate Code

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        #endregion // Boilerplate Code

        [TestMethod()]
        public void InitializeTest()
        {
            MockRegionManager regionManager = new MockRegionManager();
            MockRegion mockRegion = new MockRegion();
            regionManager.Regions.Add(RegionNames.DockingAreaRegion, mockRegion);

            ClockModule target = new ClockModule(regionManager); 
            target.Initialize();

            Assert.IsTrue(mockRegion.AddedViews.Count == 1, "View was not added to region.");
            Assert.IsTrue(mockRegion.AddedViews[0] is ClockView, "ClockView was not added to region.");
        }
    }
}